#include "ClockMgr.h"
ClockMgr::~ClockMgr()
{
	ClockList::iterator it;
	for(it = clocklist.begin(); it != clocklist.end(); ++it)
	{
		if(it->second)
			delete it->second;
	}
}
void ClockMgr::AddClock(Clock* clock, const char* clockname)
{
	if(clockname == 0 || clock == 0)
		return;
	clocklist[std::string(clockname)] = clock;
}
Clock* ClockMgr::GetClock(const char* clockname)
{
	return clocklist[std::string(clockname)];
}
void ClockMgr::UpdateClock(const char* clockname)
{
	clocklist[std::string(clockname)]->FrameStep();
}
void ClockMgr::UpdateClocks()
{
	ClockList::iterator it;
	for(it = clocklist.begin(); it != clocklist.end(); ++it)
	{
		(it->second)->FrameStep();
	}
}
void ClockMgr::ResetClock(const char* clockname)
{
	Clock*  c = GetClock(clockname);
	c->ResetClock();
}
void ClockMgr::StopClock(const char* clockname)
{

}
void ClockMgr::PauseClock(const char* clockname)
{

}
void ClockMgr::ResumeClock(const char* clockname)
{

}


void ClockMgr::BindTimerToClock(const char* clockname, ObserverID timerid)
{

}


SINGLETON_OUTER_DECLARE(ClockMgr)